package com.homwee.factory;

import com.homwee.tvap.common.ap.ComSettingManager;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.Toast;

public class ExitKeyReceiveActivity extends Activity{
	@Override
	public void onCreate(Bundle savedInstanceState) {
		Log.d("zcj","ExitKeyReceiveActivity onCreate");
		setContentView(R.layout.exit_key_receiver_layout);
		super.onCreate(savedInstanceState);
	}
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		Log.d("zcj","ExitKeyReceiveActivity onKeyDown keyCode ="+keyCode);
		if(keyCode == 4){
			Toast.makeText(this, "reveive key exit", Toast.LENGTH_SHORT).show();
			ComSettingManager.getInstance(this).getFactory().setAgingModel(0);
           // Intent intentForBarCode = new Intent();
           // intentForBarCode
           //         .setAction("com.homwee.action.STOP_FACTORY_SERVICE");
           // sendBroadcast(intentForBarCode);
            
            try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            finish();
			
		}
		return super.onKeyDown(keyCode, event);
	}

}
